<!-- 页头 -->
<page-header-wrapper [title]="''"></page-header-wrapper>
<nz-card>
    <!-- 搜索表单 -->
    <div nz-row [nzGutter]="16">
        <!-- 查询字段小于或等于3个时，不显示伸缩按钮 -->
        <div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
            <sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="false"></sf>
        </div>

        <!-- 查询字段大于3个时，根据展开状态调整布局 -->
        <ng-container *ngIf="queryFieldCount > 4">
            <div nz-col [nzSpan]="_$expand ? 24 : 18">
                <sf #sf [schema]="schema" [ui]="ui" [button]="'none'"></sf>
            </div>
            <div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
                <button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="isLoading && st.loading" (click)="st.load()">查询</button>
                <button nz-button (click)="resetSF()">重置</button>
                <button nz-button nzType="link" (click)="expandToggle()">
                    {{ !_$expand ? '展开' : '收起' }}
                    <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
                </button>
            </div>
        </ng-container>
    </div>

    <!-- 工具栏 -->
    <div nz-row>
        <div nz-col nzSpan="24">
            <button nz-button nzType="primary" (click)="add()"  acl  [acl-ability]="['scrollimg-add']">新增轮播图</button>
        </div>
    </div>

    <!-- 提示栏 -->
    <div nz-row>
        <div nz-col nzSpan="24">
            <nz-alert
                    nzType="info"
                    [nzMessage]="'当前共' + (st?.total || 0) + '行记录，选中' + selectedRows.length + '行'"
                    nzShowIcon
                    [ngStyle]="{ margin: '1rem 0' }"
            >
            </nz-alert>
        </div>
    </div>

    <!-- 数据列表 -->
    <st
            #st
            multiSort
            size="small"
            [bordered]="true"
            [scroll]="{ x: '2000px' }"
            [data]="service.$api_get_page"
            [columns]="columns"
            [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
            [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
            [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
            [loadingDelay]="500"
            [loading]="service.http.loading"
    ></st>
</nz-card>
